<template>
  <div class="mmv-title mmv-title-anchor" :title="title" :id="guid">
    <div class="line"></div>
    <h2 class="title" @click="$el.scrollIntoView()">
      <i class="icon el-icon-s-flag"></i>
      <span>{{ title }}</span>
    </h2>
    <div>
      <slot></slot>
    </div>
    <div class="issue-row">
      <slot name="issue"></slot>
    </div>
    <div class="btnBox">
      <slot name="btn"></slot>
    </div>
  </div>
</template>

<script>
import { v1 as uuid_v1 } from 'uuid'

export default {
  name: 'mmv-title',
  props: {
    title: {
      type: String,
      default: '标题'
    }
  },
  data() {
    return {
      guid: uuid_v1()
    }
  }
}
</script>

<style lang="scss" scoped>
.mmv-title {
  position: relative;
  overflow: hidden;
  padding: 0px 20px 20px;
  padding-left: 0;
  /*border-bottom: 1px solid #eaecef;*/
  // border-left: 5px solid rgb(64, 158, 255);
  position: relative;
  border-radius: 2px;
  display: flex;
  // justify-content: space-between;
  // align-items: center;
  // justify-content: start;
}
.line {
  position: absolute;
  // border-left: 5px solid rgb(64, 158, 255);
  width: 5px;
  height: 30px;
  background: #5c79e9;
}
.title {
  font-weight: 600;
  // min-width: 140px;
  line-height: 1.5;
  font-size: 20px;
  padding: 0 0 0 6px;
  margin: 0;
  color: #333;
  cursor: pointer;
}
.icon {
  opacity: 0;
  color: #5c79e9;
}
.title:hover .icon {
  opacity: 1;
}
.btnBox {
  margin-left: 50px;
}

.issue-row{
  margin-top: 8px;
  font-size: 14px;
  color: #666;
}
</style>
